<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="com.xiaokan.pojo.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Search Engine</title>

<style type="text/css">
.header {
	font-family: Arial, sans-serif;
	font-weight: bold;
	font-style: normal;
}

.link {
	font-size: 16px;
	line-height: 16px;
}

.bm25 {
	color: #009933;
	font-size: 13px;
}

.snippet {
	display: block;
	width: 200px;
}
</style>

</head>
<body>

	<h2 class="header">My Search Engine</h2>
	Web Search Engine homework #2 made by Kan Xiao#0464716
	<hr />
	<form action="query" method="post">
		<table>
			<tr>
				<td><input type="text" name="query" /></td>
				<td><input type="submit" value="Search" /></td>
			</tr>
		</table>

	</form>

	<%
		URLWrapper res[] = (URLWrapper[]) request.getAttribute("res");
		String snp[] = (String[]) request.getAttribute("snp");
		if (res != null)
			for (int i = res.length - 1; i >= 0; i--) {
				String url = res[i].getUrl().getUrl();
	%>
	<div class="link">
		<h3>
			<a href="<%=url.startsWith("http://") ? url : "http://" + url%>">
				<%=url%>
			</a>
		</h3>
	</div>
	<div class="bm25"><%=String.format("%.2f", res[i].getBm25Value())%></div>
	<div class="snippet">
		<%=snp[i]%>
	</div>

	<%
		}
	%>
</body>
</html>